Data allocation in a distributed storage system

ABSTRACT

A method for data distribution, including distributing logical addresses among an initial set of devices so as provide balanced access, and transferring the data to the devices in accordance with the logical addresses. If a device is added to the initial set, forming an extended set, the logical addresses are redistributed among the extended set so as to cause some logical addresses to be transferred from the devices in the initial set to the additional device. There is substantially no transfer of the logical addresses among the initial set. If a surplus device is removed from the initial set, forming a depleted set, the logical addresses of the surplus device are redistributed among the depleted set. There is substantially no transfer of the logical addresses among the depleted set. In both cases the balanced access is maintained.

CROSS-REFERENCE TO RELATED APPLICATION

This application is divisional of U.S. patent application Ser. No.10/620,080 filed Jul. 15, 2003, the content of which is incorporatedherein by reference.

FIELD OF THE INVENTION

The present invention relates generally to data storage, andspecifically to data storage in distributed data storage entities.

BACKGROUND OF THE INVENTION

A distributed data storage system typically comprises cache memoriesthat are coupled to a number of disks wherein the data is permanentlystored. The disks may be in the same general location, or be incompletely different locations. Similarly, the caches may be localizedor distributed. The storage system is normally used by one or more hostsexternal to the system.

Using more than one cache and more than one disk leads to a number ofvery practical advantages, such as protection against complete systemfailure if one of the caches or one of the disks malfunctions.Redundancy may be incorporated into a multiple cache or multiple disksystem, so that failure of a cache or a disk in the distributed storagesystem is not apparent to one of the external hosts, and has littleeffect on the functioning of the system.

While distribution of the storage elements has undoubted advantages, thefact of the distribution typically leads to increased overhead comparedto a local system having a single cache and a single disk. Inter alia,the increased overhead is required to manage the increased number ofsystem components, to equalize or attempt to equalize usage of thecomponents, to maintain redundancy among the components, to operate abackup system in the case of a failure of one of the components, and tomanage addition of components to, or removal of components from, thesystem. A reduction in the required overhead for a distributed storagesystem is desirable.

An article titled “Consistent Hashing and Random Trees: DistributedCaching Protocols for Relieving Hot Spots on the World Wide Web,” byKarger et al., in the Proceedings of the 29th ACM Symposium on Theory ofComputing, pages 654-663, (May 1997), whose disclosure is incorporatedherein by reference, describes caching protocols for relieving “hotspots” in distributed networks. The article describes a hashingtechnique of consistent hashing, and the use of a consistent hashingfunction. Such a function allocates objects to devices so as to spreadthe objects evenly over the devices, so that there is a minimalredistribution of objects if there is a change in the devices, and sothat the allocation is consistent, i.e., is reproducible. The articleapplies a consistent hashing function to read-only cache systems, i.e.,systems where a client may only read data from the cache system, notwrite data to the system, in order to distribute input/output requeststo the systems. A read-only cache system is used in much of the WorldWide Web, where a typical user is only able to read from sites on theWeb having such a system, not write to such sites.

An article titled “Differentiated Object Placement and Location forSelf-Organizing Storage Clusters,” by Tang et al., in Technical Report2002-32 of the University of California, Santa Barbara (November, 2002),whose disclosure is incorporated herein by reference, describes aprotocol for managing a storage system where components are added orremoved from the system. The protocol uses a consistent hashing schemefor placement of small objects in the system. Large objects are placedin the system according to a usage-based policy.

An article titled “Compact, Adaptive Placement Schemes for Non-UniformCapacities,” by Brinkmann et al., in the August, 2002, Proceedings ofthe 14^(th) ACM Symposium on Parallel Algorithms and Architecures(SPAA), whose disclosure is incorporated herein by reference, describestwo strategies for distributing objects among a heterogeneous set ofservers. Both strategies are based on hashing systems.

U.S. Pat. No. 5,875,481 to Ashton, et al., whose disclosure isincorporated herein by reference, describes a method for dynamicreconfiguration of data storage devices. The method assigns a selectednumber of the data storage devices as input devices and a selectednumber of the data storage devices as output devices in a predeterminedinput/output ratio, so as to improve data transfer efficiency of thestorage devices.

U.S. Pat. No. 6,317,815 to Mayer, et al., whose disclosure isincorporated herein by reference, describes a method and apparatus forreformatting a main storage device of a computer system. The mainstorage device is reformatted by making use of a secondary storagedevice on which is stored a copy of the data stored on the main device.

U.S. Pat. No. 6,434,666 to Takahashi, et al., whose disclosure isincorporated herein by reference, describes a memory control apparatus.The apparatus is interposed between a central processing unit (CPU) anda memory device that stores data. The apparatus has a plurality of cachememories to temporarily store data which is transferred between the CPUand the memory device, and a cache memory control unit which selects thecache memory used to store the data being transferred.

U.S. Pat. No. 6,453,404 to Bereznyi, et al., whose disclosure isincorporated herein by reference, describes a cache system thatallocates memory for storage of data items by defining a series of smallblocks that are uniform in size. The cache system, rather than anoperating system, assigns one or more blocks for storage of a data item.

SUMMARY OF THE INVENTION

It is an object of some aspects of the present invention to provide asystem for distributed data allocation.

In preferred embodiments of the present invention, a data distributionsystem comprises a plurality of data storage devices wherein data blocksmay be stored. The data blocks are stored at logical addresses that areassigned to the data storage devices according to a procedure whichallocates the addresses among the devices in a manner that reduces theoverhead incurred when a device is added to or removed from the system,and so as to provide a balanced access to the devices. The proceduretypically distributes the addresses evenly among the devices, regardlessof the number of devices in the system. If a storage device is added toor removed from the system, the procedure reallocates the logicaladdresses between the new numbers of devices so that the balanced accessis maintained. If a device has been added, the procedure only transfersaddresses to the added storage device. If a device has been removed, theprocedure only transfers addresses from the removed storage device. Inboth cases, the only transfers of data that occur are of data blocksstored at the transferred addresses. The procedure thus minimizes datatransfer and associated management overhead when the number of storagedevices is changed, or when the device configuration is changed, whilemaintaining the balanced access.

In some preferred embodiments of the present invention, the procedurecomprises a consistent hashing function. The function is used toallocate logical addresses for data block storage to the storage devicesat initialization of the storage system. The same function is used toconsistently reallocate the logical addresses and data blocks storedtherein when the number of devices in the system changes. Alternatively,the procedure comprises allocating the logical addresses between thedevices according to a randomizing process at initialization. Therandomizing process generates a table giving a correspondence betweenspecific logical addresses and the devices. The same randomizing processis used to reallocate the logical addresses and their stored data blockson a change of storage devices

In some preferred embodiments of the present invention, the procedurecomprises allocating two copies of a logical address to two separatestorage devices, the two devices being used to store copies of a datablock, so that the data block is protected against device failure. Theprocedure spreads the data block copies uniformly across all the storagedevices. On failure of any one of the devices, copies of data blocks ofthe failed device are still spread uniformly across the remainingdevices, and are immediately available to the system. Consequently,device failure has a minimal effect on the performance of thedistribution system.

There is therefore provided, according to a preferred embodiment of thepresent invention, a method for data distribution, including:

distributing logical addresses among an initial set of storage devicesso as provide a balanced access to the devices;

transferring the data to the storage devices in accordance with thelogical addresses;

adding an additional storage device to the initial set, thus forming anextended set of the storage devices consisting of the initial set andthe additional storage device; and

redistributing the logical addresses among the storage devices in theextended set so as to cause a portion of the logical addresses to betransferred from the storage devices in the initial set to theadditional storage device, while maintaining the balanced access andwithout requiring a substantial transfer of the logical addresses amongthe storage devices in the initial set.

Preferably, redistributing the logical addresses consists of no transferof the logical addresses between the storage devices in the initial set.

Preferably, distributing the logical addresses includes applying aconsistent hashing function to the initial set of storage devices so asto determine respective initial locations of the logical addresses amongthe initial set, and redistributing the logical addresses consists ofapplying the consistent hashing function to the extended set of storagedevices so as to determine respective subsequent locations of thelogical addresses among the extended set.

Alternatively, distributing the logical addresses includes applying arandomizing function to the initial set of storage devices so as todetermine respective initial locations of the logical addresses amongthe initial set, and redistributing the logical addresses consists ofapplying the randomizing function to the extended set of storage devicesso as to determine respective subsequent locations of the logicaladdresses among the extended set.

At least one of the storage devices preferably includes a fast accesstime memory; alternatively or additionally, at least one of the storagedevices preferably includes a slow access time mass storage device.

Preferably, the storage devices have substantially equal capacities, anddistributing the logical addresses includes distributing the logicaladdresses substantially evenly among the initial set, and redistributingthe logical addresses consists of redistributing the logical addressessubstantially evenly among the extended set.

Alternatively, a first storage device of the storage devices has a firstcapacity different from a second capacity of a second storage device ofthe storage devices, and distributing the logical addresses includesdistributing the logical addresses substantially according to a ratio ofthe first capacity to the second capacity, and redistributing thelogical addresses includes redistributing the logical addressessubstantially according to the ratio.

Preferably, distributing the logical addresses includes allocating aspecific logical address to a first storage device and to a secondstorage device, the first and second storage devices being differentstorage devices, and storing the data consists of storing a first copyof the data on the first storage device and a second copy of the data onthe second storage device.

The method preferably includes writing the data from a host external tothe storage devices, and reading the data to the external host from thestorage devices.

There is further provided, according to a preferred embodiment of thepresent invention, an alternative method for distributing data,including:

distributing logical addresses among an initial set of storage devicesso as provide a balanced access to the devices;

transferring the data to the storage devices in accordance with thelogical addresses;

removing a surplus device from the initial set, thus forming a depletedset of the storage devices comprising the initial storage devices lessthe surplus storage device; and

redistributing the logical addresses among the storage devices in thedepleted set so as to cause logical addresses of the surplus device tobe transferred to the depleted set, while maintaining the balancedaccess and without requiring a substantial transfer of logical addressesamong the storage devices in the depleted set.

Preferably, redistributing the logical addresses consists of no transferof the logical addresses to the storage devices in the depleted setapart from the logical addresses of the surplus device.

Distributing the logical addresses preferably consists of applying aconsistent hashing function to the initial set of storage devices so asto determine respective initial locations of the logical addresses amongthe initial set, and redistributing the logical addresses preferablyincludes applying the consistent hashing function to the depleted set ofstorage devices so as to determine respective subsequent locations ofthe logical addresses among the depleted set.

Alternatively, distributing the logical addresses consists of applying arandomizing function to the initial set of storage devices so as todetermine respective initial locations of the logical addresses amongthe initial set, and redistributing the logical addresses includesapplying the randomizing function to the depleted set of storage devicesso as to determine respective subsequent locations of the logicaladdresses among the depleted set.

The storage devices preferably have substantially equal capacities, anddistributing the logical addresses consists of distributing the logicaladdresses substantially evenly among the initial set, and redistributingthe logical addresses includes redistributing the logical addressessubstantially evenly among the depleted set.

There is further provided, according to a preferred embodiment of thepresent invention, a method for distributing data among a set of storagedevices, including:

applying a consistent hashing function to the set so as to allocatelogical addresses to respective primary storage devices of the set andso as to provide a balanced access to the devices;

forming subsets of the storage devices by subtracting the respectiveprimary storage devices from the set;

applying the consistent hashing function to the subsets so as toallocate the logical addresses to respective secondary storage devicesof the subsets while maintaining the balanced access to the devices; and

storing the data on the respective primary storage devices and a copy ofthe data on the respective secondary storage devices in accordance withthe logical addresses.

There is further provided, according to a preferred embodiment of thepresent invention, a method for distributing data among a set of storagedevices, including:

applying a randomizing function to the set so as to allocate logicaladdresses to respective primary storage devices of the set and so as toprovide a balanced access to the devices;

forming subsets of the storage devices by subtracting the respectiveprimary storage devices from the set;

applying the randomizing function to the subsets so as to allocate thelogical addresses to respective secondary storage devices of the subsetswhile maintaining the balanced access to the devices; and

storing the data on the respective primary storage devices and a copy ofthe data on the respective secondary storage devices in accordance withthe logical addresses.

There is further provided, according to a preferred embodiment of thepresent invention, a data distribution system, including:

an initial set of storage devices among which are distributed logicaladdresses so as provide a balanced access to the devices, and whereindata is stored in accordance with the logical addresses; and

an additional storage device to the initial set, thus forming anextended set of the storage devices comprising the initial set and theadditional storage device, the logical addresses being redistributedamong the storage devices in the extended set so as to cause a portionof the logical addresses to be transferred from the storage devices inthe initial set to the additional storage device, while maintaining thebalanced access and without requiring a substantial transfer of thelogical addresses among the storage devices in the initial set.

There is further provided, according to a preferred embodiment of thepresent invention, a data distribution system, including:

an initial set of storage devices among which are distributed logicaladdresses so as provide a balanced access to the devices, and whereindata is stored in accordance with the logical addresses; and

a depleted set of storage devices, formed by subtracting a surplusstorage device from the initial set, the logical addresses beingredistributed among the storage devices in the depleted set so as tocause logical addresses of the surplus device to be transferred to thedepleted set, while maintaining the balanced access and withoutrequiring a substantial transfer of the logical addresses among thestorage devices in the depleted set.

Preferably, redistributing the logical addresses comprises no transferof the logical addresses to the storage devices in the depleted setapart from the logical addresses of the surplus device.

The distributed logical addresses are preferably determined by applyinga consistent hashing function to the initial set of storage devices soas to determine respective initial locations of the logical addressesamong the initial set, and redistributing the logical addressespreferably includes applying the consistent hashing function to thedepleted set of storage devices so as to determine respective subsequentlocations of the logical addresses among the depleted set.

Alternatively, the distributed logical addresses are determined byapplying a randomizing function to the initial set of storage devices soas to determine respective initial locations of the logical addressesamong the initial set, and redistributing the logical addressespreferably includes applying the randomizing function to the depletedset of storage devices so as to determine respective subsequentlocations of the logical addresses among the depleted set.

The storage devices preferably have substantially equal capacities, andthe distributed logical addresses are distributed substantially evenlyamong the initial set, and redistributing the logical addresses includesredistributing the logical addresses substantially evenly among thedepleted set.

Alternatively or additionally, a first storage device included in thestorage devices has a first capacity different from a second capacity ofa second storage device included in the storage devices, and thedistributed logical addresses are distributed substantially according toa ratio of the first capacity to the second capacity, and redistributingthe logical addresses includes redistributing the logical addressessubstantially according to the ratio.

Preferably, the distributed logical addresses include a specific logicaladdress allocated to a first storage device and a second storage device,the first and second storage devices being different storage devices,and storing the data includes storing a first copy of the data on thefirst storage device and a second copy of the data on the second storagedevice.

The system preferably includes a memory having a table wherein is storeda correspondence between a plurality of logical addresses and a specificstorage device in the initial set, wherein the plurality of logicaladdresses are related to each other by a mathematical relation.

There is further provided, according to a preferred embodiment of thepresent invention, a data distribution system, including:

a set of data storage devices to which is applied a consistent hashingfunction so as to allocate logical addresses to respective primarystorage devices of the set and so as to provide a balanced access to thedevices; and

subsets of the storage devices formed by subtracting the respectiveprimary storage devices from the set, the consistent hashing functionbeing applied to the subsets so as to allocate the logical addresses torespective secondary storage devices of the subsets while maintainingthe balanced access to the devices, data being stored on the respectiveprimary storage devices and a copy of the data being stored on therespective secondary storage devices in accordance with the logicaladdresses.

There is further provided, according to a preferred embodiment of thepresent invention, a data distribution system, including:

a set of data storage devices to which is applied a randomizing functionso as to allocate logical addresses to respective primary storagedevices of the set and so as to provide a balanced access to thedevices; and

subsets of the storage devices formed by subtracting the respectiveprimary storage devices from the set, the randomizing function beingapplied to the subsets so as to allocate the logical addresses torespective secondary storage devices of the subsets while maintainingthe balanced access to the devices, data being stored on the respectiveprimary storage devices and a copy of the data being stored on therespective secondary storage devices in accordance with the logicaladdresses.

The present invention will be more fully understood from the followingdetailed description of the preferred embodiments thereof, takentogether with the drawings, a brief description of which is given below.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates distribution of data addresses among data storagedevices, according to a preferred embodiment of the present invention;

FIG. 2 is a flowchart describing a procedure for allocating addresses tothe devices of FIG. 1, according to a preferred embodiment of thepresent invention;

FIG. 3 is a flowchart describing an alternative procedure for allocatingaddresses to the devices of FIG. 1, according to a preferred embodimentof the present invention;

FIG. 4 is a schematic diagram illustrating reallocation of addresseswhen a storage device is removed from the devices of FIG. 1, accordingto a preferred embodiment of the present invention;

FIG. 5 is a schematic diagram illustrating reallocation of addresseswhen a storage device is added to the devices of FIG. 1, according to apreferred embodiment of the present invention;

FIG. 6 is a flowchart describing a procedure that is a modification ofthe procedure of FIG. 2, according to a preferred embodiment of thepresent invention;

FIG. 7 is a schematic diagram which illustrates a fully mirroreddistribution of data for the devices of FIG. 1, according to a preferredembodiment of the present invention; and

FIG. 8 is a flowchart describing a procedure for performing thedistribution of FIG. 7, according to a preferred embodiments of thepresent invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Reference is now made to FIG. 1, which illustrates distribution of dataaddresses among data storage devices, according to a preferredembodiment of the present invention. A storage system 12 comprises aplurality of separate storage devices 14, 16, 18, 20, and 22, alsorespectively referred to herein as storage devices B₁, B₂, B₃, B₄, andB₅, and collectively as devices B_(n). It will be understood that system12 may comprise substantially any number of physically separate devices,and that the five devices B_(n) used herein are by way of example.Devices B_(n) comprise any components wherein data 34, also hereintermed data D, may be stored, processed, and/or serviced. Examples ofdevices B_(n) comprise random access memory (RAM) which has a fastaccess time and which are typically used as caches, disks whichtypically have a slow access time, or any combination of suchcomponents. A host 24 communicates with system 12 in order to read datafrom, or write data to, the system. A central processing unit (CPU) 26,using a memory 28, manages system 12, and allocates data D to devicesB_(n). The allocation of data D by CPU 26 to devices B_(n) is describedin more detail below.

Data D is processed in devices B_(n) at logical block addresses (LBAs)of the devices by being written to the devices from host 24 and/or readfrom the devices by host 24. At initialization of system 12 CPU 26distributes the LBAs of devices B_(n) among the devices using one of thepre-defined procedures described below. CPU 26 may then store data D atthe LBAs.

In the description of the procedures hereinbelow, devices B_(n) areassumed to have substantially equal capacities, where the capacity of aspecific device is a function of the device type. For example, fordevices that comprise mass data storage devices having slow accesstimes, such as disks, the capacity is typically defined in terms ofquantity of data the device may store. For devices that comprise fastaccess time memories, such as are used in caches, the capacity istypically defined in terms of throughput of the device. Those skilled inthe art will be able to adapt the procedures when devices B_(n) havedifferent capacities, in which case ratios of the capacities aretypically used to determine the allocations. The procedures allocate thelogical stripes to devices B_(n) so that balanced access to the devicesis maintained, where balanced access assumes that taken overapproximately 10,000×N transactions with devices B_(n), the fraction ofcapacities of devices B_(n) used are equal to within approximately 1%,where N is the number of devices B_(n), the values being based on aBernoulli distribution.

FIG. 2 is a flowchart describing a procedure 50 for allocating LBAs todevices B_(n), according to a preferred embodiment of the presentinvention. The LBAs are assumed to be grouped into k logicalstripes/tracks, hereinbelow termed stripes 36 (FIG. 1), which arenumbered 1, . . . , k, where k is a whole number. Each logical stripecomprises one or more consecutive LBAs, and all the stripes have thesame length. Procedure 50 uses a randomizing function to allocate astripe s to devices B_(n) in system 12. The allocations determined byprocedure 50 are stored in a table 32 of memory 28.

In an initial step 52, CPU 26 determines an initial value of s, thetotal number T_(d) of active devices B_(n) in system 12, and assignseach device B_(n) a unique integral identity between 1 and T_(d). In asecond step 54, the CPU generates a random integer R between 1 andT_(d), and allocates stripe s to the device B_(n) corresponding to R. Ina third step 56, the allocation determined in step 54 is stored in table32. Procedure 50 continues, in a step 58, by incrementing the value ofs, until all stripes of device B_(n) have been allocated, i.e., untils>k, at which point procedure 50 terminates.

Table I below is an example of an allocation table generated byprocedure 50, for system 12, wherein T_(d)=5. The identifying integersfor each device B_(n), as determined by CPU 26 in step 52, are assumedto be 1 for B₁, 2 for B₁, 2 for B₅. TABLE I Random Stripe s Number RDevice B_(s)   1 3 B₃   2 5 B₅ . . . . . . . . . 6058 2 B₂ 6059 2 B₂6060 4 B₄ 6061 5 B₅ 6062 3 B₃ 6063 5 B₅ 6064 1 B₁ 6065 3 B₃ 6066 2 B₂6067 3 B₃ 6068 1 B₁ 6069 2 B₂ 6070 4 B₄ 6071 5 B₅ 6072 4 B₄ 6073 1 B₁6074 5 B₅ 6075 3 B₃ 6076 1 B₁ 6077 2 B₂ 6078 4 B₄ . . . . . . . . .

FIG. 3 is a flowchart showing steps of a procedure 70 using a consistenthashing function to allocate stripes to devices B_(n), according to analternative preferred embodiment of the present invention. In an initialstep 72, CPU 26 determines a maximum number N of devices B_(n) forsystem 12, and a number of points k for each device. The CPU thendetermines an integer M, such that M>>N·k.

In a second step 74, CPU 26 determines N sets J_(n) of k random valuesS_(ab), each set corresponding to a possible device B_(n), as given byequations (1):J₁={S₁₁, S₁₂, . . . , S_(1k)} for device B₁;J₂={S₂₁, S₂₂, . . . , S_(2k)}for device B₂;J_(N)={S_(N1), S_(N2), . . . , S_(Nk)} for device B_(N).  (1)

Each random value S_(ab) is chosen from {0, 1, 2, . . . , M−1}, and thevalue of each S_(ab) may not repeat, i.e., each value may only appearonce in all the sets. The sets of random values are stored in memory 28.

In a third step 76, for each stripe s CPU 26 determines a value of smod(M) and then a value of F(s mod(M)), where F is a permutationfunction that reassigns the value of s mod(M) so that in a final step 78consecutive stripes will generally be mapped to different devices B_(n).

In final step 78, the CPU finds, typically using an iterative searchprocess, the random value chosen in step 74 that is closest to F(smod(M)). CPU 26 then assigns the device B_(n) of the random value tostripe s, according to equations (1).

It will be appreciated that procedure 70 illustrates one type ofconsistent hashing function, and that other such functions may be usedby system 12 to allocate LBAs to devices operating in the system. Allsuch consistent hashing functions are assumed to be comprised within thescope of the present invention.

Procedure 70 may be incorporated into memory 28 of system 12 (FIG. 1),and the procedure operated by CPU 26 when allocation of stripes s arerequired, such as when data is to be read from or written to system 12.Alternatively, a table 30 of the results of applying procedure 70,generally similar to the first and last columns of Table I, may bestored in memory 28, and accessed by CPU 26 as required.

FIG. 4 is a schematic diagram illustrating reallocation of stripes whena storage device is removed from storage system 12, according to apreferred embodiment of the present invention. By way of example, deviceB₃ is assumed to be no longer active in system 12 at a time t=1, afterinitialization time t=1, and the stripes initially allocated to thedevice, and any data stored therein, are reallocated to the depleted setof devices B₁, B₂, B₄, B₅ of the system. Device B₃ may be no longeractive for a number of reasons known in the art, such as device failure,or the device becoming surplus to the system, and such a device isherein termed a surplus device. The reallocation is performed usingprocedure 50 or procedure 70, preferably according to the procedure thatwas used at time t=0. As is illustrated in FIG. 4, and as is describedbelow, stripes from device B₃ are substantially evenly redistributedamong devices B₁, B₂, B₄, B₅.

If procedure 50 (FIG. 2) is applied at t=1, the procedure is applied tothe stripes of device B₃, so as to randomly assign the stripes to theremaining active devices of system 12. In this case, at step 52 thetotal number of active devices T_(d)=4, and identifying integers foreach active device B_(n) are assumed to be 1 for B₁, 2 for B₂, B₄, 3 forB₅. CPU 26 generates a new table, corresponding to the first and lastcolumns of Table II below for the stripes that were allocated to B₃ att=0, and the stripes are reassigned according to the new table. Table IIillustrates reallocation of stripes for device B₃ (from the allocationshown in Table I). TABLE II Random Device B_(s) Number R Device B_(s)Stripe s t = 0 t = 1 t = 1   1 B₃ 1 B₁   2 B₅ B₅ . . . . . . . . . . . .6058 B₂ B₂ 6059 B₂ B₂ 6060 B₄ B₄ 6061 B₅ B₅ 6062 B₃ 3 B₅ 6063 B₅ B₅ 6064B₁ B₁ 6065 B₃ 2 B₂ 6066 B₂ B₂ 6067 B₃ 3 B₅ 6068 B₁ B₁ 6069 B₂ B₂ 6070 B₄B₄ 6071 B₅ B₅ 6072 B₄ B₄ 6073 B₁ B₁ 6074 B₅ B₅ 6075 B₃ 4 B₄ 6076 B₁ B₁6077 B₂ B₂ 6078 B₄ B₄ . . . . . . . . . . . .

It will be appreciated that procedure 50 only generates transfer ofstripes from the device that is no longer active in system 12, and thatthe procedure reallocates the stripes, and any data stored therein,substantially evenly over the remaining active devices of the system. Noreallocation of stripes occurs in system 12 other than stripes that wereinitially allocated to the device that is no longer active. Similarly,no transfer of data occurs other than data that was initially in thedevice that is no longer active. Also, any such transfer of data may beperformed by CPU 26 transferring the data directly from the inactivedevice to the reallocated device, with no intermediate device needing tobe used.

Similarly, by consideration of procedure 70 (FIG. 3), it will beappreciated that procedure 70 only generates transfer of stripes, andreallocation of data stored therein, from the device that is no longeractive in system 12, i.e., device B₃. Procedure 70 reallocates thestripes (and thus their data) from B₃ substantially evenly over theremaining devices B₁, B₂, B₄, B₅ of the system, no reallocation ofstripes or data occurs in system 12 other than stripes/data that wereinitially in B₃, and such data transfer as may be necessary may beperformed by direct transfer to the remaining active devices. It willalso be understood that if B₃ is returned to system 12 at some futuretime, the allocation of stripes after procedure 70 is implemented is thesame as the initial allocation generated by the procedure.

FIG. 5 is a schematic diagram illustrating reallocation of stripes whena storage device is added to storage system 12, according to a preferredembodiment of the present invention. By way of example, a device 23,also herein termed device B₆, is assumed to be active in system 12 attime t=2, after initialization time t=0, and some of the stripesinitially allocated to an initial set of devices B₁, B₂, B₃, B₄, B₅, andany data stored therein, are reallocated to device B₆. The reallocationis performed using procedure 70 or a modification of procedure 50(described in more detail below with reference to FIG. 6), preferablyaccording to the procedure that was used at time t=0. As is illustratedin FIG. 5, and as is described below, stripes from devices B₁, B₂, B₃,B₄, B₅ are substantially evenly removed from the devices and aretransferred to device B₆. B₁, B₂, B₃, B₄, B₅, B₆ act as an extended setof the initial set.

FIG. 6 is a flowchart describing a procedure 90 that is a modificationof procedure 50 (FIG. 2), according to an alternative preferredembodiment of the present invention. Apart from the differencesdescribed below, procedure 90 is generally similar to procedure 50, sothat steps indicated by the same reference numerals in both proceduresare generally identical in implementation. As in procedure 50, procedure90 uses a randomizing function to allocate stripes s to devices B_(n) insystem 12, when a device is added to the system. The allocationsdetermined by procedure 90 are stored in table 32 of memory 28.

Assuming procedure 50 is applied at t=2, at step 52 the total number ofactive devices T_(d)=6, and identifying integers for each active deviceB_(n) are assumed to be 1 for B₁, 2 for B₂, 3 for B₃, 4 for B₄, 5 forB₅, 6 for B₆. In a step 91 CPU 26 determines a random integer between 1and 6.

In a step 92, the CPU determines if the random number corresponds to oneof the devices present at time t=0. If it does correspond, then CPU 26returns to the beginning of procedure 90 by incrementing stripe s, viastep 58, and no reallocation of stripe s is made. If it does notcorrespond, i.e., the random number is 6, corresponding to device B₆,the stripe is reallocated to device B₆ step 56, the reallocated locationis stored in table 32. Procedure 90 then continues to step 58. Table IIIbelow illustrates the results of applying procedure 90 to the allocationof stripes given in Table II. TABLE III Random Device B_(s) Number RDevice B_(s) Stripe s t = 0 t = 2 t = 2   1 B₃ 6 B₆   2 B₅ 4 B₅ . . . .. . . . . . . . 6058 B₂ 5 B₂ 6059 B₂ 3 B₂ 6060 B₄ 5 B₄ 6061 B₅ 6 B₆ 6062B₃ 3 B₅ 6063 B₅ 1 B₅ 6064 B₁ 3 B₁ 6065 B₃ 1 B₂ 6066 B₂ 6 B₆ 6067 B₃ 4 B₅6068 B₁ 5 B₁ 6069 B₂ 2 B₂ 6070 B₄ 1 B₄ 6071 B₅ 5 B₅ 6072 B₄ 2 B₄ 6073 B₁4 B₁ 6074 B₅ 5 B₅ 6075 B₃ 1 B₄ 6076 B₁ 3 B₁ 6077 B₂ 6 B₆ 6078 B₄ 1 B₄ .. . . . . . . . . . .

It will be appreciated that procedure 90 only generates transfer ofstripes, and thus reallocation of data, to device B₆. The procedurereallocates the stripes to B₆ by transferring stripes, substantiallyevenly, from devices B₁, B₂, B₃, B₄, B₅ of the system, and no transferof stripes, or data stored therein, occurs in system 12 other thanstripes/data transferred to B₆. Any such data transfer may be madedirectly to device B₆, without use of an intermediate device B_(n).

It will also be appreciated that procedure 70 may be applied when deviceB₆ is added to system 12. Consideration of procedure 70 shows thatsimilar results to those of procedure 90 apply, i.e., that there is onlyreallocation of stripes, and data stored therein, to device B₆. As forprocedure 90, procedure 70 generates substantially even reallocation ofstripes/data from the other devices of the system.

FIG. 7 is a schematic diagram which illustrates a fully mirroreddistribution of data D in storage system 12 (FIG. 1), and FIG. 8 is aflowchart illustrating a procedure 100 for performing the distribution,according to preferred embodiments of the present invention. Procedure100 allocates each specific stripe to a primary device B_(n1), and acopy of the specific stripe to a secondary device B_(n2), n1≠tn2, sothat each stripe is mirrored. To implement the mirrored distribution, ina first step 102 of procedure 100, CPU 26 determines primary deviceB_(n1) for locating a stripe using procedure 50 or procedure 70. In asecond step 104, CPU 26 determines secondary device B_(n2) for thestripe using procedure 50 or procedure 70, assuming that device B_(n1)is not available. In a third step 106, CPU 26 allocates copies of thestrip to devices B_(n1) and B_(n2), and writes the device identifies toa table 34 in memory 28, for future reference. CPU 26 implementsprocedure 100 for all stripes 36 in devices B_(n).

Table IV below illustrates devices B_(n1) and B_(n2) determined forstripes 6058-6078 of Table I, where procedure 50. TABLE IV Stripe DeviceB_(n1) Device B_(n2) 6058 B₂ B₄ 6059 B₂ B₅ 6060 B₄ B₂ 6061 B₅ B₄ 6062 B₃B₁ 6063 B₅ B₄ 6064 B₁ B₃ 6065 B₃ B₄ 6066 B₂ B₅ 6067 B₃ B₁ 6068 B₁ B₃6069 B₂ B₅ 6070 B₄ B₁ 6071 B₅ B₃ 6072 B₄ B₂ 6073 B₁ B₃ 6074 B₅ B₁ 6075B₃ B₅ 6076 B₁ B₃ 6077 B₂ B₄ 6078 B₄ B₁

If any specific device B_(n) becomes unavailable, so that only one copyof the stripes on the device is available in system 12, CPU 26 mayimplement a procedure similar to procedure 100 to generate a new secondcopy of the stripes that were on the unavailable device. For example, ifafter allocating stripes 6058-6078 according to Table IV, device B₃becomes unavailable, copies of stripes 6062, 6065, 6067, and 6075, needto be allocated to new devices in system 12 to maintain full mirroring.Procedure 100 may be modified to find the new device of each stripe byassuming that the remaining device, as well as device B₃, isunavailable. Thus, for stripe 6062, CPU 26 assumes that devices B₁ andB₃ are unavailable, and determines that instead of device B₃ the stripeshould be written to device B₄. Table V below shows the devices that themodified procedure 100 determines for stripes 6058, 6060, 6062, 6065,6072, and 6078, when B₃ becomes unavailable. TABLE V Stripe s DeviceB_(n1) Device B_(n2) 6062 B₁ B₂ 6065 B₄ B₅ 6067 B₁ B₄ 6075 B₅ B₂

It will be appreciated that procedure 100 spreads locations for stripes36 substantially evenly across all devices B_(n), while ensuring thateach pair of copies of any particular stripe are on different devices,as is illustrated in FIG. 7. Furthermore, the even distribution oflocations is maintained even when one of devices B_(n), becomesunavailable. Either copy, or both copies, of any particular stripe maybe used when host 24 communicates with system 12. It will also beappreciated that in the event of one of devices B_(n) becomingunavailable, procedure 100 regenerates secondary locations for copies ofstripes 36 that are evenly distributed over devices B_(n).

Referring back to FIG. 1, it will be understood that the sizes of tables30, 32, or 34 are a function of the number of stripes in system 12, aswell as the number of storage devices in the system. Some preferredembodiments of the present invention reduce the sizes of tables 30, 32,or 34 by duplicating some of the entries of the tables, by relatingdifferent stripes mathematically. For example, if system 12 comprises2,000,000 stripes, the same distribution may apply to every 500,000stripes, as illustrated in Table VI below. Table VI is derived fromTable I. TABLE VI Stripe s Stripe s Stripe s Stripe s Device B_(s)   1500,001 1,000,001 1,500,001 B₃   2 500,002 1,000,002 1,500,002 B₅ . . .. . . . . . . . . . . . 6059 506,059 1,006,059 1,506,059 B₂ 6060 506,0601,006,060 1,506,060 B₄ . . . . . . . . . . . . . . .

It will be appreciated that procedures such as those described above maybe applied substantially independently to different storage devices, ortypes of devices, of a storage system. For example, a storage system maycomprise a distributed fast access cache coupled to a distributed slowaccess mass storage. Such a storage system is described in more detailin the U.S. Application titled “Distributed Independent Cache Memory,”filed on even date, and assigned to the assignee of the presentinvention. The fast access cache may be assigned addresses according toprocedure 50 or modifications of procedure 50, while the slow accessmass storage may be assigned addresses according to procedure 70 ormodifications of procedure 70.

It will thus be appreciated that the preferred embodiments describedabove are cited by way of example, and that the present invention is notlimited to what has been particularly shown and described hereinabove.Rather, the scope of the present invention includes both combinationsand subcombinations of the various features described hereinabove, aswell as variations and modifications thereof which would occur topersons skilled in the art upon reading the foregoing description andwhich are not disclosed in the prior art.

1. A method for distributing data, comprising: distributing logicaladdresses among an initial set of storage devices so as provide abalanced access to the devices; transferring the data to the storagedevices in accordance with the logical addresses; removing a surplusdevice from the initial set, thus forming a depleted set of the storagedevices comprising the initial storage devices less the surplus storagedevice; and redistributing the logical addresses among the storagedevices in the depleted set so as to cause logical addresses of thesurplus device to be transferred to the depleted set, while maintainingthe balanced access and without requiring a substantial transfer oflogical addresses among the storage devices in the depleted set.
 2. Amethod according to claim 1, wherein redistributing the logicaladdresses comprises no transfer of the logical addresses to the storagedevices in the depleted set apart from the logical addresses of thesurplus device.
 3. A method according to claim 1, wherein distributingthe logical addresses comprises applying a consistent hashing functionto the initial set of storage devices so as to determine respectiveinitial locations of the logical addresses among the initial set, andwherein redistributing the logical addresses comprises applying theconsistent hashing function to the depleted set of storage devices so asto determine respective subsequent locations of the logical addressesamong the depleted set.
 4. A method according to claim 1, whereindistributing the logical addresses comprises applying a randomizingfunction to the initial set of storage devices so as to determinerespective initial locations of the logical addresses among the initialset, and wherein redistributing the logical addresses comprises applyingthe randomizing function to the depleted set of storage devices so as todetermine respective subsequent locations of the logical addresses amongthe depleted set.
 5. A method according to claim 1, wherein at least oneof the storage devices comprises a fast access time memory.
 6. A methodaccording to claim 1, wherein at least one of the storage devicescomprises a slow access time mass storage device.
 7. A method accordingto claim 1, wherein the storage devices have substantially equalcapacities, and wherein distributing the logical addresses comprisesdistributing the logical addresses substantially evenly among theinitial set, and wherein redistributing the logical addresses comprisesredistributing the logical addresses substantially evenly among thedepleted set.
 8. A method according to claim 1, wherein a first storagedevice comprised in the storage devices has a first capacity differentfrom a second capacity of a second storage device comprised in thestorage devices, and wherein distributing the logical addressescomprises distributing the logical addresses substantially according toa ratio of the first capacity to the second capacity, and whereinredistributing the logical addresses comprises redistributing thelogical addresses substantially according to the ratio.
 9. A methodaccording to claim 1, wherein distributing the logical addressescomprises allocating a specific logical address to a first storagedevice and to a second storage device, the first and second storagedevices comprising different storage devices, and wherein storing thedata comprises storing a first copy of the data on the first storagedevice and a second copy of the data on the second storage device.
 10. Amethod according to claim 1, and comprising writing the data from a hostexternal to the storage devices, and reading the data to the externalhost from the storage devices.
 11. A data distribution system,comprising: an initial set of storage devices among which aredistributed logical addresses so as provide a balanced access to thedevices, and wherein data is stored in accordance with the logicaladdresses; and a depleted set of storage devices, formed by subtractinga surplus storage device from the initial set, the logical addressesbeing redistributed among the storage devices in the depleted set so asto cause logical addresses of the surplus device to be transferred tothe depleted set, while maintaining the balanced access and withoutrequiring a substantial transfer of the logical addresses among thestorage devices in the depleted set.
 12. A system according to claim 11,wherein redistributing the logical addresses comprises no transfer ofthe logical addresses to the storage devices in the depleted set apartfrom the logical addresses of the surplus device.
 13. A system accordingto claim 11, wherein the distributed logical addresses are determined byapplying a consistent hashing function to the initial set of storagedevices so as to determine respective initial locations of the logicaladdresses among the initial set, and wherein redistributing the logicaladdresses comprises applying the consistent hashing function to thedepleted set of storage devices so as to determine respective subsequentlocations of the logical addresses among the depleted set.
 14. A systemaccording to claim 11, wherein the distributed logical addresses aredetermined by applying a randomizing function to the initial set ofstorage devices so as to determine respective initial locations of thelogical addresses among the initial set, and wherein redistributing thelogical addresses comprises applying the randomizing function to thedepleted set of storage devices so as to determine respective subsequentlocations of the logical addresses among the depleted set.
 15. A systemaccording to claim 11, wherein at least one of the storage devicescomprises a fast access time memory.
 16. A system according to claim 11,wherein at least one of the storage devices comprises a slow access timemass storage device.
 17. A system according to claim 11, wherein thestorage devices have substantially equal capacities, and wherein thedistributed logical addresses are distributed substantially evenly amongthe initial set, and wherein redistributing the logical addressescomprises redistributing the logical addresses substantially evenlyamong the depleted set.
 18. A system according to claim 11, wherein afirst storage device comprised in the storage devices has a firstcapacity different from a second capacity of a second storage devicecomprised in the storage devices, and wherein the distributed logicaladdresses are distributed substantially according to a ratio of thefirst capacity to the second capacity, and wherein redistributing thelogical addresses comprises redistributing the logical addressessubstantially according to the ratio.
 19. A system according to claim11, wherein the distributed logical addresses comprise a specificlogical address allocated to a first storage device and a second storagedevice, the first and second storage devices comprising differentstorage devices, and wherein storing the data comprises storing a firstcopy of the data on the first storage device and a second copy of thedata on the second storage device.
 20. A system according to claim 11,and comprising a memory having a table wherein is stored acorrespondence between a plurality of logical addresses and a specificstorage device in the initial set, wherein the plurality of logicaladdresses are related to each other by a mathematical relation.